﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEditor;
using UnityEditor.AssetImporters;
using UnityEngine;

namespace huqiang.AssetsFormat
{
    public class AssetsHandle : AssetPostprocessor
    {
        public void OnAssignMaterialModel(Material mat, Renderer render)
        {

        }
        public static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
        {

        }
        public void OnPostprocessAnimation(GameObject game, AnimationClip clip)
        {

        }
        public void OnPostprocessAssetbundleNameChanged(string src, string des, string c)
        {

        }
        public void OnPostprocessAudio(AudioClip clip)
        {

        }
        public void OnPostprocessCubemap(Cubemap cubemap)
        {

        }
        public void OnPostprocessGameObjectWithAnimatedUserProperties(GameObject game, EditorCurveBinding[] bindings)
        {

        }
        public void OnPostprocessGameObjectWithUserProperties(GameObject game, string[] propNames, object[] values)
        {

        }
        public void OnPostprocessMaterial(Material mat)
        {

        }
        public void OnPostprocessMeshHierarchy(GameObject game)
        {

        }
        public void OnPostprocessModel(GameObject game)
        {

        }
        public void OnPostprocessPrefab(GameObject root)
        {

        }
        public void OnPostprocessSpeedTree(GameObject game)
        {

        }
        public void OnPostprocessSprites(Texture2D t2d, Sprite[] sprites)
        {

        }
        public void OnPostprocessTexture(Texture2D t2d)
        {

        }
        public void OnPreprocessAnimation()
        {
            //ModelImporter modelImporter = assetImporter as ModelImporter;
            //modelImporter.clipAnimations = modelImporter.defaultClipAnimations;
        }
        public void OnPreprocessAsset()
        {
            //if (assetImporter.importSettingsMissing)
            //{
            //    ModelImporter modelImporter = assetImporter as ModelImporter;
            //    if (modelImporter != null)
            //    {
            //        if (!assetPath.Contains("@"))
            //            modelImporter.importAnimation = false;
            //        modelImporter.materialImportMode = ModelImporterMaterialImportMode.None;
            //    }
            //}
        }
        public void OnPreprocessAudio()
        {
            //if (assetPath.Contains("mono"))
            //{
            //    AudioImporter audioImporter = (AudioImporter)assetImporter;
            //    audioImporter.forceToMono = true;
            //}
        }
        public void OnPreprocessMaterialDescription(MaterialDescription description, Material mat, AnimationClip[] clips)
        {

        }
        public void OnPreprocessModel()
        {
            //if (assetPath.Contains("@"))
            //{
            //    ModelImporter modelImporter = assetImporter as ModelImporter;
            //    modelImporter.materialImportMode = ModelImporterMaterialImportMode.None;
            //}
        }
        public void OnPreprocessSpeedTree()
        {

        }
        public void OnPreprocessTexture()
        {
            //if (assetPath.Contains("_bumpmap"))
            //{
            //    TextureImporter textureImporter = (TextureImporter)assetImporter;
            //    textureImporter.convertToNormalmap = true;
            //}
        }
    }
}
